﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UWP.Douban.Api;
using UWP.Douban.Models;
using Windows.UI.Xaml.Navigation;

namespace UWP.Douban.Mvvm
{
    public class MyGroupVm : BaseVm
    {
        public MyGroupVm()
        {
            MyGroups = new ObservableCollection<Group>();
        }

        public ObservableCollection<Group> MyGroups { get;private set; }


        public override async void OnNavigatedTo(NavigationEventArgs e)
        {
            //var me = await SampleData.SampleDataUtil.GetMe();
            var me = await GroupApi.UserInfoGet(Common.UserId);

            foreach (var group in me.GroupInfo.Groups)
            {
                MyGroups.Add(group);
            }

            base.OnNavigatedTo(e);
        }


    }
}
